<?
if($_POST)
{
	$p1 = $_POST;
	foreach($p1 as $key => $value )
	{
		mysql_query(" update setting set   stt_value = '$value'       where  stt_name = '$key ' limit 1   ");
	}
}
?>
<script src="js/301a.js" type="text/javascript"></script>
<div id="colorpicker301" class="colorpicker301"></div>
<p>
    <form action="" method="post" name="tcptest">




    <fieldset>
    <legend>Setting box</legend>
    
 <?  
 $stt2 = mysetting(); 
// print_r($stt2);
 foreach($stt2 as  $stt )
 {
 ?>   
    
<label><?=str_replace("_"," ",$stt[1])?></label>
<?
		if(strstr($stt[1],"text") || strstr($stt[1],"keyword") || strstr($stt[1],"description")){
				?>
					<textarea  name="<?=$stt[1]?>" style = "width:350px;height:100px;"><?=$stt[2]?></textarea>
				<?
		}else{
			?>
				<input name="<?=$stt[1]?>" id="<?=$stt[1]?>_" type="text" value="<?=$stt[2]?>"  
<? if(strstr($stt[1],"color")) { ?>style="background-color:#<?=str_replace("#","",$stt[2])?>" onchange="this.style.backgroundColor=this.value;" <? } ?> 
<? if(strstr($stt[1],"size")) { ?> size="3" onkeyup="javascript:var k1 = this.value; var k = window.event.keyCode;if(k >= 48 && k  <= 57) return true;else {this.value = this.value.substr(0,(this.value.length)-1);}";  <? } ?>
/>
			<?
		}
?>
	<? if(strstr($stt[1],"color")) { ?><A HREF="#" onclick="showColorGrid3('<?=$stt[1]?>_','none');return false;" onmouseout="document.getElementById('<?=$stt[1]?>_').style.backgroundColor=document.getElementById('<?=$stt[1]?>_').value;" ><img src="images/sel.gif"></A> <? } ?>
<?
 }	
?>

<BR><BR>
    <input  type="submit" value="<?=btsubmit($r['md_id'])?>" />
    
    
    
    </fieldset>
    
    </form>

</p>